package cn.meizhu.user.controller;

import cn.meizhu.user.domain.User;
import cn.meizhu.user.service.IUserService;
import cn.meizhu.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private IUserService userService;


    @PostMapping("/verifyPhone")
    public AjaxResult verifyPhone(@RequestBody User user){
        //根据手机号查询表
        User byPhone = userService.findByPhone(user.getPhone());
        if (byPhone == null){
            return AjaxResult.me();
        }else {
            return AjaxResult.me().setMessage("手机号已经注册");
        }
    }


}
